import 'package:flutter/material.dart';

//ListView列表组件
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('AspectRatio组件'),
          backgroundColor: Colors.pink[100],
        ),
        body: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    //Row组件
    return AspectRatio(
      aspectRatio: 2 / 1,
      child: Container(color: Colors.red),
    );
  }

  //页面上显示一个容器  宽度是屏幕的宽度  高度是宽度的一半
}
